package com.huqiwen.dom4j;

import java.io.File;
import java.util.Iterator;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

public class ReadXmlTest {
	public static void main(String[] args) {
		File file = new File("e:/t.xml");
		SAXReader reader = new SAXReader();
		try {
			Document document = reader.read(file);
			Element root = document.getRootElement();
			Element foo;			
			for (Iterator i = root.elementIterator();i.hasNext();) {
				foo = (Element)i.next();				
				System.out.println(foo.getName()+":"+foo.attributeValue("valueBY"));
			}
		} catch (DocumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
